<?php
	
class Table_Mariage extends Zend_Db_Table_Abstract
{
    protected $_name    = 'mariage';
    protected $_primary = array('VIP_NUMERO', 'VIP_VIP_NUMERO', 'DATE_EVENEMENT');
    protected $_sequence = FALSE;
 	
        
    public function insertMariage($numVip, $numVipVip, $dateEvent, $lieu, $dateFin, $motifFin){
                $data = array('VIP_NUMERO'=> $numVip, 'VIP_VIP_NUMERO' => $numVipVip,
                                        'DATE_EVENEMENT' => $dateEvent, 'MARIAGE_LIEU' => $lieu,
                                        'MARIAGE_FIN' => $dateFin, 'MARIAGE_MOTIFFIN' => $motifFin);
                $this->insert($data);
    }
	
	public function getMariage($id) {
			
			$req=$this->select()
			->setIntegrityCheck(false)
			->from(array('m'=>'mariage'), array('*'))
			->join(array('v'=>'vip'),'m.vip_numero=v.vip_numero',array('*'))
			->where('v.vip_numero = ?', $id)
			->orwhere('m.vip_vip_numero=?', $id);
			
			$resu=$this->fetchAll($req);
			return $resu;
	}
	
	public function supprMariage($id){
		$this->delete('VIP_NUMERO ='.(int)$id);
	}
	public function supprMariage2($id){
		$this->delete('VIP_VIP_NUMERO ='.(int)$id);
	}
	
}